package com.iflytek.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.iflytek.bean.Book;

public interface BookMapper {

	@Select("select * from t_book")
	List<Book> getAllBooks();

	@Select("select * from t_book where id=#{id}")
	Book getBookById(Integer id);

	@Insert("insert into t_book(book_name, book_no, category, author, publisher, "
			+ "location, stock, total_stock, cover, pub_date)"
			+ "values(#{bookName}, #{bookNo}, #{category}, #{author}, #{publisher}, "
			+ "#{location}, #{stock}, #{totalStock}, #{cover}, #{pubDate})")
	void insert(Book book);

	@Update("update t_book set book_name=#{bookName}, book_no=#{bookNo}, category=#{category} where id=#{id}")
	void update(Book book);

	@Delete("delete from t_book where id=#{id}")
	void delete(Integer id);

}
